################################################################################
#
# CODE TO CONVERT GALLUP 1997 DATA FROM .POR TO .DTA
# RUN THIS BEFORE ANY STATA CODE
#
# FOR PAPER: 
# Learning from Shared News: When Abundant Information Leads to Belief Polarization
# Bowen, Dmitriev, Galperti
# Quarterly Journal of Economics
################################################################################
# Clear data
rm(list=ls())

# Install and load haven package
install.packages("haven")
library(haven)

# Store file path
Root <- "C:/"
User <- "bluey"
dir <- paste(Root,"Users",User,"Dropbox", "Final_Final_Final","Gallup replication","Data",sep="/")

# Read in por file (portable SPSS)
por1997 <- read_por(file = paste(dir,"9711028.por", sep="/"))

# Write to dta file (Stata dataset, version 14)
write_dta(data = por1997, path = paste(dir,"gallup1997.dta", sep="/"), version = 14)